<button class="btn btn-success btn-xs" data-toggle="modal" data-target="#taskDetail{{ $id }}">资源预览</button>

<div class="modal fade" id="taskDetail{{ $id }}" tabindex="-1" role="dialog" aria-labelledby="taskDelete"
     aria-hidden="true">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true" style="font-size: 36px;">
                    &times;
                </button>
                <h4 class="modal-title" id="myModalLabel">资源预览-{{ $data->task_name }}</h4>
            </div>
            <div class="modal-body">
                <div style="overflow-x:auto;white-space:nowrap;">
                    <table class="table table-hover grid-table">
                        <thead style="text-align:center">
                        <tr>
                            <th>姓名</th>
                            <th>性别</th>
                            <th>年龄</th>
                            <th>地区</th>
                            <th>手机号</th>
                            <th>微信</th>
                            <th>备注</th>
                        </tr>
                        </thead>
                        <tbody>
                        @if(!is_null($data->taskRelated))
                            @foreach($data->taskRelated as $value)
                                <tr>
                                    <td>{{ $value->name }}</td>
                                    <td>{{ __('l.genderArr')[$value->gender] }}</td>
                                    <td>{{ $value->age }}</td>
                                    <td>{{ $value->area }}</td>
                                    <td>{{ $value->mobile }}</td>
                                    <td>{{ $value->wechat }}</td>
                                    <td>{{ $value->remark }}</td>
                                </tr>
                            @endforeach
                        @endif
                        </tbody>
                    </table>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="button" class="btn btn-primary" onclick="taskDelete({{ $id }})">提交</button>
            </div>
        </div>
    </div>
</div>
<script>
    function taskDelete(id) {
        ajaxPostFunc('/admin/ajax/taskDelete', {
            id: id,
            _token: $.admin.token
        }, {}, res => {
            console.log(res);
            window.location.reload();
        });
    }
</script>
